<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Hasee
  Date: 2020/9/25
  Time: 23:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.5.1.js"></script>

    <script>
        $(function () {
            $("#btn").click(function () {
                $.post("${pageContext.request.contextPath}/h3",function (data) {
                    var html="";
                    alert(data.length);
                    for (let i=0;i<data.length;i++){
                        html+="<tr>"+
                                "<td>"+data[i].name+"<td>"+
                                "<td>"+data[i].age+"<td>"+
                                "<td>"+data[i].sex+"<td>"+
                            "<tr>";

                    }
                    $("#content").html(html);

                })
            })
        })
    </script>
</head>
<body>

<input type="button" value="加载数据" id="btn">
    <table>
        <tr>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
        </tr>
        <tbody id="content">

        </tbody>
    </table>
</body>
</html>
